Method for loading and customizing data and programmes loaded in a smart card

ABSTRACT

A method for loading data and programs in the memory of an electronic component includes a first phase in which data is loaded in the memory of the component. A validation phase then verifies the data loaded in the component memory. A second phase of loading data in the memory is carried out only if the data loaded during the first loading phase is valid. The second phase includes at least a step in which data is loaded and then validated.

[0001] The present invention relates to portable electronic objects such as electronic microcircuit cards, known as smart cards. It applies more generally to any independent embedded device provided with a processing unit associated with program and data memories, and a communication module with or without contact for being connected with an electronic device comprising reading and/or writing means. Program and data memories generally comprise a memory of the read only or non-rewriteable type but which is programmable only once at the time of its manufacture, for example of the ROM (Read Only Memory) type, and a volatile memory accessible in write and read mode, for example of the RAM (Random Access Memory) type, and used for storage of temporary data during the execution of a program. Some chips also comprise a non-volatile memory, accessible both in read and write mode, for example of the EEPROM (Electrically Erasable Programmable Read Only Memory) or FLASH type.

[0002] Such devices are designed to be connected to electronic systems in order to fulfil with them particular functions in the context of one or more applications. Generally these applications (bank, communication, health) require a high level of security against fraudulent usage.

[0003] The manufacture of smart cards comprises several phases, each involving different participants. Thus the first phase concerns the creation of a chip itself, which is done by the manufacturer of the electronic component. In some cases the manufacturer also carries out an initialisation of the chip consisting in loading into the ROM memory of the chip a program for loading the utilisation program and other information, some of which are specific to each card, such as a serial number.

[0004] The following phase of manufacturing a smart card concerns the embedding of the chip. This phase is carried out by an entity called an embedder, which loads other information into the card, some also being generic, such as that permitting the creation of a system of files in the non-volatile memory, and others specific to the final use of the card (for example a module serial number).

[0005] Finally, the last manufacturing phase is carried out by an entity called a personaliser, whose role is to load into the non-volatile memory the information specific to each user (information identifying the bearer of the card, and passwords), as well as other generic information.

[0006] Generally, the tools used during each of these phases are different. Each chip manufacturer applies an initialisation method which is peculiar to him. The card embedder which loads some information in the non-volatile memory of the component uses commands, known as physical commands, which require knowledge of the physical organisation of the memory of the chip (the address of the files etc). The personalisation phase uses so-called logic commands which require knowledge of the logical organisation of the memory, for example the name of the directories and the names of the files which are stored therein.

[0007] The physical commands are very rapid and very flexible. Because of this, they are very dangerous since they are not subjected to checks. By virtue of these commands, an ill-intentioned person could for example create corrupted file structures preventing the normal functioning of the chip, whilst it is personalised, or load therein programs enabling secret information to be recovered, such as keys or access codes contained in the memories of the component.

[0008] Logic commands protect against this type of attack but are on the other hand very slow, which has an influence on the time necessary for the personalisation of the cards and therefore on the cost of the cards.

[0009] In addition, the coexistence of these two types of command requires the operating system of a chip to perform additional verification operations, which further extends the time required for producing the cards whilst not guaranteeing the integrity of the data written in the memory of the component.

[0010] The aim of the present invention is to eliminate these drawbacks.

[0011] To this end, it proposes a fast and secure loading and personalisation method making it possible to load information and programs in the memory of an electronic component.

[0012] According to the invention, this method is characterised in that it comprises:

[0013] a first phase of loading information into the memory of the component,

[0014] a validation phase comprising the verification of the information loaded into the memory of the component, and

[0015] a second phase of loading information into the memory of the component, performed solely if the information loaded during the first loading phase is valid, this second phase comprising at least one step of loading information and validating this information.

[0016] By virtue of these provisions, the method according to the invention uses only physical commands which are rapid for loading the major part of the non-volatile memory of the component, these commands being accompanied by security mechanisms for guaranteeing the integrity of the data loaded into the memories of the component.

[0017] Advantageously, the validation phase comprises the determination by a processing unit of the component of a value characteristic of the information loaded during the first loading phase, the comparison of the characteristic value calculated with a value previously transmitted to the processing unit, and the validation of the information loaded into the memories of the component if the characteristic value calculated corresponds to that which was transmitted.

[0018] The said characteristic value may be a condensed value of the information loaded during the first loading phase. Thus it may be obtained by applying a hash function to the information loaded during the first loading phase.

[0019] The said characteristic value can also be an MAC code obtained by applying a hash function to the information loaded during the first loading phase and by involving a secret key which was previously loaded into the memory of the component. In this way the first loading phase can be performed only by an authorised person who knows the secret key.

[0020] According to one particularity of the invention, this method comprises a preliminary phase comprising the introduction into the memory of the component of addresses of predefined areas of the memory in which information can be written during the second loading phase, and at least one value characteristic of the information liable to be loaded during the first loading phase.

[0021] According to another particularity of the invention, the second information loading phase is performed by transmitting to the component at least one logic write command associated with information to be loaded into the memory of the component.

[0022] Alternatively, each information loading step performed during the second loading phase can advantageously comprise the transmission of a physical write command comprising information to be loaded into the memory of the component and a value characteristic of the write command, the determination by a processing unit of the component of a characteristic value applied to the write command, the comparison of the characteristic value received with that which was calculated, and the validation of the write command if the comparison has not revealed any difference.

[0023] Each physical write command can be encrypted. The data are then deciphered by means of a secret key which was previously loaded into a memory of the component.

[0024] According to another particularity of the invention, each command to write information implemented during the second loading phase is associated with the value of a counter which is incremented at each command, this value being verified by the processing unit, which rejects a command if the value of the associated counter does not correspond to the expected value.

[0025] At the end of the first loading phase, provision can be made for transmitting an end of loading phase to the component, which has the effect of triggering the validation phase.

[0026] Each command transmitted to the processing unit can be associated with a signature, the processing unit accepting this command only if the signature received corresponds to a signature resulting from a calculation which it applied to the end of loading command.

[0027] The method according to the invention can comprise several cycles each comprising a first loading phase, a validation phase and a second loading phase, each loading cycle relating only to a respective memory area, distinct from those loaded during other loading cycles.

[0028] One method for implementing the method according to the invention will be described below, by way of non-limiting example, with reference to the accompanying drawings, in which

[0029]FIG. 1 depicts schematically the electronic component of a smart card;

[0030]FIG. 2 shows the organisation of the non-volatile memory of the component at the end of phase of loading the non-confidential information;

[0031]FIG. 3 shows the concatenation of the various steps of the method according to the invention in the form of a flow diagram.

[0032]FIG. 1 shows an electronic component 1 designed to be integrated into a so-called intelligent smart card. This component generally comprises a processing unit 2 or microprocessor, connected by a communication bus 3 to memories 4, 5, 6, and to a link 7 to a reading and possibly writing terminal. This connection consists either of contact areas in the case of a smart card with contacts, or an antenna in the case of a contactless smart card. These memories comprise a non-erasable memory 4, for example of the ROM type, a non-volatile memory 5 accessible in write and read mode, for example of the EEPROM or FLASH type, and a volatile memory 6 or RAM.

[0033] In accordance with the method according to the invention 20 illustrated in FIG. 3, an initialisation processing 21 performed at the time of its manufacture is first of all applied to the electronic component. This processing consists in writing in the memory 4 a program permitting the loading of the non-volatile memory, as well as confidential information, such as a serial number and possibly a secret key, which can alternatively be determined according to the serial number.

[0034] Next the component 1 is delivered to the card embedder, which in particular carries out a first phase 22 of loading the common or non-confidential data into the non-volatile memory 5 by means of the loading program stored in the memory 4 and using so-called physical, non-secure, commands which are transmitted to the microprocessor 2 by means of a personalisation terminal. The loading program carries out only a check of the addresses where the data are written. These can therefore be written in any order. It is even possible to write several times to the same addresses in the memory 5.

[0035] During this phase, it is possible to authorise the reading of the content of the memory 5 for the purpose of verification but, if a high level of security is required, such a reading may be inhibited, the data written during this phase next being verified.

[0036] As shown in FIG. 2, the data loaded during this phase comprise the common or non-confidential parts 13 of an operating system and/or of application programs, a file structure 14, and common or non-confidential information 15, one part 12 of the memory 5 remaining free. In addition, some predefined areas 11 of the memory 5 are left free for the storage of confidential data or programs or those specific to the user for whom the smart card is intended.

[0037] Once the common or non-confidential data are loaded into the memory 5, the terminal transmits 23 a phase change command which triggers a process of verification and validation of the data loaded into this memory and then inhibits any further loading of non-confidential information, at least in the same memory area.

[0038] This command advantageously comprises a phase change instruction as well as a characteristic value such as a condensed value representing the content of the memory 5, this value being able for example to be obtained by means of a hash function.

[0039] If it is wished to authenticate the entity which carried out this loading, the condensed value can be an MAC code. This code can be obtained by means of a so-called hash function in combination with a secret key. It is for example possible to apply the hash function MD5 or SHA-1 (Secure Hash Algorithm-1) making it possible to calculate a binary sequence, for example of 160 bits, representing in a condensed manner the content of the memory 5, such a function being designed so that a slight modification to the content of the memory gives rise to a significant modification to the binary sequence thus calculated.

[0040] This phase change command can also be encrypted by means of a secret key, which may be the same as the previous one.

[0041] These arrangements guarantee that the information loaded during this phase were loaded by an authorised person. If such is not the case, the loading program does not pass to the following phase and awaits a further loading or phase change command.

[0042] On reception of a valid phase change command, the loading program stored in the memory 4 carries out the verification 24 of the content of this memory in order to validate the integrity of all the data which were sent to the component during this phase. This verification comprises first of all the calculation of a characteristic value, applied to all or part of the memory 5. Next, the loading program compares 25 this value thus calculated with a reference value which was transmitted in the phase change command.

[0043] If a difference is detected, the first loading phase is considered to have failed and an error code is transmitted to the personalisation terminal. The loading program then returns to step 22. In the contrary case, this loading phase is validated and can be followed by a phase of loading the specific or confidential data.

[0044] In the event of failure of the first loading phase, provision can be made for erasing the information which was loaded in order to avoid any risk of fraudulent use of the component.

[0045] This verification step guarantees the integrity of the non-confidential data even if the loading was carried out by means of physical commands. As the physical commands are much faster than logic commands, the method according to the invention makes it possible to load the non-confidential data into the memory 5 very quickly.

[0046] During the following phase (steps 26 to 29), the specific or confidential data to be loaded into the memory 5 are transmitted 26 to the component one after the other by the personalisation terminal, in the form of write commands which are verified 27 by the microprocessor 2 before being executed.

[0047] According to the invention, each write command comprises the value of the data to be written, the address for writing the data in the memory, and the length of the data, as well as a redundancy code if necessary. The whole can be associated with a condensed value characteristic of the command. This condensed value may be a signature.

[0048] This signature is for example obtained by means of a hash function. The binary sequence obtained can be encrypted by means of a key, which may be the secret key stored at step 21 in the memory 4, in order to obtain a message authentication code or MAC.

[0049] The whole of the command can also be decrypted by means of the secret key or keys installed at step 21.

[0050] These arrangements guarantee that the specific or confidential data are loaded by an authorised person.

[0051] On reception of a command to write a specific or confidential data item, the microprocessor decrypts the encrypted signature associated with the command received and, if this corresponds to the command received (step 28), proceeds with the writing of the data item associated with the command at the address indicated.

[0052] In order to determine whether the signature received corresponds to the write command received, the microprocessor 2 applies the hash function to the command received and compares the signature received and decrypted with the signature thus calculated.

[0053] In this way a write command can be executed only if it has previously been signed by means of the secret key and processed by means of the appropriate hash function.

[0054] Advantageously, each write command is also associated with a command number which is incremented at each write command, the microprocessor 2 accepting a loading command only if the command number corresponds to the number of the command previously received incremented by one.

[0055] During the initialisation phase, provision can be made for loading the respective addresses of the free areas 11, the microprocessor of each write command verifying whether the associated address corresponds to a free area address. These free area addresses can also be loaded in association with a loading command number, the microprocessor also verifying at each write command whether the command number corresponds to the writing address. Provision can also be made for a specific preliminary loading phase triggered at the end of the initialisation phase, during which this information (addresses of the free areas and corresponding loading command numbers) are transmitted in a secure manner to the microprocessor 2 in order to be stored in the non-volatile memory 5.

[0056] In this way it is ensured that the free areas 11 of the memory 5 can be filled only in a predefined order.

[0057] Once all the data to be loaded have been transmitted to the card and stored by the microprocessor 2 in the memory 5, the terminal transmits to the card an end of phase command preferably containing a phase number. This command can also be encrypted and transmitted to the microprocessor 2 in the form of an MAC signature and comprise a command number which corresponds to the number of the last loading command transmitted, incremented by one.

[0058] The reception 30 of such a phase change message triggers the activation 31 of the application program by the microprocessor. The latter can therefore no longer receive loading commands.

[0059] Provision can advantageously be made for several data loading cycles each comprising a free personalisation phase (steps 22 to 25) and a confidential personalisation phase (steps 26 to 30). In this case, it is preferable to use several memories and to divide the memory 5 into separate partitions, each memory or partition being completely filled during a loading cycle. This arrangement is necessary for example when the loading of the data must be carried out by several entities.

[0060] It suffices for this purpose for the program for loading into the memory 4 to be designed to load only a first partition by executing steps 22 to 30, and for the data loaded during the first cycle to include the loading of a second loading program specifically designed to load only the second partition, this program being activated following the reception by the microprocessor of a phase change command at the end of the secure personalisation phase of the first partition. Several loading cycles comprising the execution of steps 22 to 30 can thus be concatenated, the reception of the phase change command at the end of the last cycle triggering the activation of the application program.

[0061] According to one particularity of the invention, the method uses an encryption key for the secure personalisation command, specific to each entity carrying out the loading of part of the memory 5.

[0062] Naturally, in order to load the various partitions of the memory 5, it is possible to use only one loading program, namely the one which is stored in the memory 4. It is then necessary, before executing a loading command, to check that the loading request relates to addresses belonging to the partition corresponding to the current loading cycle. A change in cycle triggering a modification to the address field to be loaded. It is also possible to provide for the loading commands of the second phase to be logic commands. 

1. A method for loading information into a memory of an electronic component (1) characterised in that it comprises: a first phase of loading (22) information into the memory (5) of the component, a validation phase (23, 24) comprising the verification of the information loaded into the memory of the component, and a second phase of loading (26 to 29) information into the memory (5) of the component, performed solely if the information loaded during the first loading phase is valid, this second phase comprising at least one step comprising a loading of information and a validation of this information.
 2. A method according to claim 1, characterised in that the validation phase (23, 24) comprises the determination by a processing unit (2) of the component (1) of a value characteristic of the information loaded during the first loading phase, the comparison of the characteristic value calculated with a value previously transmitted to the processing unit, and the validation of the information loaded into the memories of the component if the characteristic value calculated corresponds to that which was transmitted.
 3. A method according to one of claims 1 to 2, characterised in that it comprises a preliminary phase comprising the introduction into the memory of the component of information defining predefined areas of the memory (5) in which information can be written during the second loading phase, and at least one value characteristic of the information liable to be loaded during the first loading phase.
 4. A method according to one of claims 1 to 3, characterised in that the second information loading phase is performed by transmitting to the component at least one logic write command associated with information to be loaded into the memory (5) of the component.
 5. A method according to claims 1 to 3, characterised in that each information loading step performed during the second loading phase comprises the transmission (26) of a physical write command comprising information to be loaded into the memory (5) of the component, a loading address and a value characteristic of the write command, the determination (27) by a processing unit (2) of the component of a characteristic value applied to the write command, the comparison (28) of the characteristic value received with that which was calculated, and the validation (29) of the write command if the comparison has not revealed any difference.
 6. A method according to claim 4 or 5, characterised in that the said characteristic values are condensed values of the information loaded.
 7. A method according to claim 4 or 5, characterised in that the said characteristic values are obtained by applying a hash function to the information loaded.
 8. A method according to claim 4 or 5, characterised in that the said characteristic values are MAC codes which are verified by applying a hash function to the information loaded and by involving a secret key which was previously loaded into a memory of the component.
 9. A method according to one of claims 4 to 8, characterised in that each information writing command made during the second loading phase is associated with the value of a counter which is incremented at each command, this value being verified by the processing unit (2), which rejects a command if the associated counter value does not correspond to the expected value.
 10. A method according to one of claims 1 to 9, characterised in that the validation phase is triggered following the reception (23) by the component (1) of an end of loading command.
 11. A method according to claim 10, characterised in that the end of loading command is associated with a signature, the processing unit accepting this command only if the signature received corresponds to a signature resulting from a calculation which it has applied to the end of loading command.
 12. A method according to one of claims 5 to 11, characterised in that each command transmitted to the processing unit (2) is decrypted by means of a secret key which was previously loaded into a memory (4) of the component.
 13. A method according to one of claims 1 to 12, characterised in that it comprises several loading cycles each comprising a first loading phase, a validation phase and a second loading phase, each loading cycle relating only to a respective memory area, distinct from those loaded during other loading cycles. 